package com.itheima.exception;

import com.itheima.domain.Code;
import com.itheima.domain.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionControllerAdvice {
    @ExceptionHandler(BusinessException.class)
    public Result doBusinessException(BusinessException e){
        return new Result(Code.BUSINESS_EXCEPTION,e.getMessage());
    }
    public Result doException(Exception e){
        return new Result(Code.OTHER_EXCEPTION,"系统正忙，请联系客服，电话自己找!");
    }
}
